import request from "./request";

export function getBlogs(page = 1, limit = 10, category = -1) {
  return request.get("/api/blog", {
    params: {
      page,
      limit,
      category,
    },
  });
}

export function getBlogTypes() {
  return request.get("/api/blogtype");
}

export function getBlog(id) {
  return request.get(`/api/blog/${id}`);
}

export function postComment(commentInfo) {
  return request.post("/api/comment", commentInfo);
}

export function getComment(blogid, page = 1, limit = 10) {
  return request.get("/api/comment", {
    params: {
      blogid,
      page,
      limit,
    },
  });
}
